package com.cosina.game.tank.model.impl;

import android.graphics.Point;

import com.cosina.game.tank.Constants;
import com.cosina.game.tank.ImageManager;
import com.cosina.game.tank.ai.AI;
import com.cosina.game.tank.ai.AIFactory;
import com.cosina.game.tank.model.Tank;
import com.cosina.game.tank.model.TimeElapse;
import com.cosina.game.tank.model.War;
import com.cosina.game.tank.util.DirectionAdapter;

public class EnemyTank extends Tank  implements TimeElapse{
	private final AI ai;
	public EnemyTank(Point location, War war) {
		super(location, war);
		ai = AIFactory.getAI(this);
	}

	@Override
	public final DirectionAdapter getImageAdapter() {
		return imageAdapter;
	}

	@Override
	public final boolean isEvil() {
		return true;
	}

	DirectionAdapter imageAdapter = new DirectionAdapter() {
		@Override
		public Object doDown() {
			return ImageManager.enemyDown;
		}

		@Override
		public Object doLeft() {
			return ImageManager.enemyLeft;
		}

		@Override
		public Object doRight() {
			return ImageManager.enemyRight;
		}

		@Override
		public Object doUp() {
			return ImageManager.enemyUp;
		}

	};

	@Override
	public void withTimeGo() {
		if(isSick()){
			return ;
		}
		ai.doNext();
	}

	@Override
	public int getSpeed() {
		return Constants.ENEMY_MOVE_SPEED;
	}
}
